package com.fick.common;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ContantsProperties {
	private static Log log = LogFactory.getLog(ContantsProperties.class);
	private static ContantsProperties properties = null;
	private static Properties prop = new Properties();
	
	private ContantsProperties(){
            try {
            	InputStream in = this.getClass().getClassLoader().getResourceAsStream("config.properties"); 
				prop.load(in);
				in.close();  
				log.info("load properties sucessfully!");
			} catch (IOException e) {
				log.error("load properties error!",e);
			}
	}
	
	public static ContantsProperties getContantsProperties(){
		if(properties == null){
			properties = new ContantsProperties();
		}
		return properties;
	}
	
	public String getStringProperty(String key){
		return prop.getProperty(key);
	}

}
